package com.z6school.manage.controller;

import com.z6school.manage.common.pojo.JsonResult;
import com.z6school.manage.po.Teacher;
import com.z6school.manage.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/teacher/")
public class TeacherController {

    @Autowired
    private TeacherService teacherService;

    @RequestMapping("doFindAllMessage")
    @ResponseBody
    public JsonResult doFindAllMessage(String username, Integer pageCurrent){
        return new JsonResult(teacherService.findAllMessage(username, pageCurrent));
    }

    @RequestMapping("addTeacherMessage")
    @ResponseBody
    public JsonResult addTeacherMessage(Teacher teacher){
        teacherService.addTeacherMessage(teacher);
        return new JsonResult("保存成功");
    }

    @RequestMapping("doDeleteObjects")
    @ResponseBody
    public JsonResult doDeleteObjects(String ids){
        teacherService.doDeleteObjects(ids);
        return new JsonResult("delete ok");
    }

    @RequestMapping("doUpdateObjects")
    @ResponseBody
    public JsonResult doUpdateObjects(String id){
        teacherService.doDeleteObjects(id);
        return new JsonResult("delete ok");
    }

}
